package com.qihetimes.earthangel.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * Knife4j
 *
 * @author ：f4cklangzi@gmail.com
 * @date ：Created At 2021/12/4
 */
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfiguration {
    
    @Bean
    public Docket defaultApi2() {
        Contact contact = new Contact("f4cklangzi", "", "f4cklangzi@gmail.com");
        ApiInfo apiInfo = new ApiInfoBuilder()
            .title("地球天使")
            .description("地球天使 API文档")
            .contact(contact)
            .version("1.0")
            .build();
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo)
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.qihetimes.earthangel.controller"))
            .paths(PathSelectors.any()).build();
    }
}
